home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 1 (Walnut Creek)
/
Aminet - June 1993 [Walnut Creek].iso
/
aminet
/
gfx
/
3d
/
rayshade40_enh2.lha
/
ENHANCE
/
sweptsph.doc
< prev
next >
Wrap
Text File
|
1992-07-12
|
4KB
|
99 lines
Syntax:
sweptsph SweptSphCenter SweptSphRadius
SweptSphCenter
bezier x0 y0 z0 x1 y1 z1 x2 y2 z2 x3 y3 z3
coeffs x0 x1 x2 x3 y0 y1 y2 y3 z0 z1 z2 z3
xbezier x0 x1 x2 x3
ybezier y0 y1 y2 y3
zbezier z0 z1 z2 z3
xcoeffs x0 x1 x2 x3
ycoeffs y0 y1 y2 y3
zcoeffs z0 z1 z2 z3
SweptSphRadius
r0 r1 r2 r3
Examples:
sweptsph bezier -10 0 0 -10 0 10 10 0 -10 10 0 0
1 0 0 0
sweptsph coeffs .65 15.7 -22.2 0 0 0 0 0 1 56 -110 65.5
1 -1 0 0
sweptsph
xbezier 0 10 -10 0
ycoeffs 0 10 -10 0
zbezier 10 0 0 -10
.5 6 -6 0
This primitive is defined as a sphere of varying radius swept, or
extruded along a path in space. The path is defined in one of several ways.
The path can either be defined as four points which define a bezier path, where
the path passes through the first and last endpoints with the second and third
points defining the slope or tangent line for the curve at the first and last
points. This is specified as "bezier p1 p2 p3 p4" where pn is an x,y,z
triplet.
A second way to define the curve is to specify the coeffecients for
the parametric equations that define the curve. This is specified as
"coeffs fx fy fz" where each fn is a third order equation, c0 c1 c2 c3, where
fn = c0 + c1*x + c2*x^2 + c3*x^3.
A third way is to use any combination of parametric bezier curves
or function coeffs. These are specified as "nbezier" or "ncoeffs" where n
is x, y, or z. These are followed by four numbers that are interpreted as
the coeffecients for the parametric variable x, y, or z in the case of
"ncoeffs" or as the bezier curve where the first number is the starting
value, the last value is the ending value, and the second and third values
define the "speed" at which the curve leaves the endpoints.
The radius is specifed as four numbers which are the coefficients for
a third order equation over the interval [0,1]. This is specified as
"c0 c1 c2 c3" where r(x) = c0 + c1*x + c2*x^2 + c3*x^3.
Both the radius and the center equations are evaluated on the interval
[0,1].
KNOWN BUGS:
There are a few known bugs:
1) Often there is a "shadow" ring around the diameter of the primitive
where the functions are evaluated at t = 0.5. Presumably this is due to
roundoff error possibly in the root finding algorithms, perhaps elsewhere.
2) Some configurations using the "bezier" specification result in
garbage. Usually this can be avoided by changing the defining point's values
slightly without affecting the curve noticeably. Examples are "bezier -10 0 0
-10 0 0 10 0 0 10 0 0" and "bezier -10 0 0 10 0 10 -10 0 10 10 0 0".
OTHER PROBLEMS:
Using third order equations to define the center path or the radius
requires solving a tenth order equation when checking for intersection. All
roots over the interval (0,1) must be found, not just the smallest. The root
finder used was one that I wrote that uses a combination of Newton-Rasphson and
bisection. It ends up being fairly slow and probably could use some speeding
up. A few possibilities would be using Sturm sequences to find the number
of roots over an interval (I tried this but my algorithm did not find all the
roots and thus produced gaps in the surface. I plan on trying to fix it if I
can.) and to reduce the polynomial by deviding through by known roots before
solving for remaining roots.
Any comments, bug reports, or suggestions for changes or improvements
will be greatly appreciated.
---Larry Coffin
lcoffin@clciris.chem.umr.edu